import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

# 基本的一些数生成
print(range(10), [i for i in range(10)], np.random.rand(10))
# 定义数据，数组
a = [
    "爱情,动作", "冒险,惊悚", "爱情,冒险", "生活", "喜剧,动作"
]
# 分割数组
a_list = [j for ii in [i.split(",") for i in a] for j in ii]
a_array = np.array(a_list)
print(a_list)
a_zero = np.zeros((10, a_array.shape[0]))
print(a_zero)
a_dataframe = pd.DataFrame(a_zero)
print(a_dataframe.sum())
# a_dataframe.sum().plot(kind='bar')
# 随机伪造--数据

a_dataframe[0][1] = 1
a_dataframe[0][2] = 1
a_dataframe[2][3] = 1

print(a_dataframe.sum())

a_dataframe.sum().plot(kind='bar')
plt.plot(a_dataframe.sum())
plt.show()